package com.zzy.caching;

import com.google.common.collect.ComparisonChain;
import com.google.common.collect.Ordering;

public class Student implements Comparable<Student>{

	private Integer id;
	private String name;


	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}


	//实现Comparable接口
	public int compareTo(Student that) {
			    return ComparisonChain.start()
			            .compare(this.id, that.id)
			            .compare(this.name, that.name,Ordering.natural().nullsLast())
			            .result();
	  }

	
}
